const BASE = 'https://lxl0iglm.lc-cn-n1-shared.com/1.1';
export const $http = function (url, method = 'GET', data = {}) {
    return new Promise((resolve, reject) => {
        // axios内部使用的是XMLHttpRequest发起请求
        uni.request({
            url: BASE + url,
            method,
            data,
            header: {
                'X-LC-Id': 'LXl0IGlm4AX7F78gRpqKyArw-gzGzoHsz',
                'X-LC-Key': 'vWLUK6CopF22qftLmUp4pWLx',
                'content-type': 'application/json'
            },
            success: (res) => {
                resolve(res); //将成功的结构给到then
            },

            fail: (err) => {
                reject(err); //将失败的信息给到catch
            }
        });
    });
};

export const $get = (url, data = {}) => {
    return $http(url, 'GET', data);
};
